package cn.edu.gench.learn.service;

import cn.edu.gench.learn.dao.CityDao;
import cn.edu.gench.learn.model.City;
import cn.edu.gench.learn.model.District;
import cn.edu.gench.learn.model.Province;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/5/5.
 */
@Service
public class CityService {


    @Autowired
    private CityDao cityDao;

    /***
     *
     * 获得所有的省份
     *
     * @return
     */
    public List<Province> getAllProvince() {

        return cityDao.queryProvince();
    }

    /**
     *
     * 根据省得ID 获得城市列表
     *
     * @param pid
     * @return
     */
    public List<City> getCityByPid(int pid) {
        return cityDao.queryCityByPId(pid);
    }

    /**
     *  根据城市的ID 获得区县的列表
     *
     * @param cid
     * @return
     */
    public List<District> getDistrictByCid(int cid) {
        return cityDao.queryDistrictByCid(cid);
    }
}
